import { Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
import { Router } from '@angular/router';
import { faBookOpen, faCode, faFont, faGlobe, faInfoCircle, faKey, faUserCog } from '@fortawesome/free-solid-svg-icons';
import { CookieService } from 'ngx-cookie-service';
import { LOCAL_STORAGE, StorageService } from 'ngx-webstorage-service';
import { AppConfig } from 'src/environments/environment';
import {
  ProfileViewView,
  TenantView
} from "../../../graphql/aap/auth/auth_account/model/account_password_auth_service.model";
@Component({
  selector: 'app-main-header',
  templateUrl: './main-header.component.html',
  styleUrls: ['./main-header.component.scss']
})
export class MainHeaderComponent implements OnInit {
  @Input()
  collapsed = false;
  @Output()
  collapsedChange = new EventEmitter();
  faBookOpen = faBookOpen;
  faInfoCircle = faInfoCircle;
  faGlobe = faGlobe;
  faFont = faFont;
  faCode = faCode;
  faUserCog = faUserCog;
  faKey = faKey;
  tenantView!: TenantView;
  profile!: ProfileViewView;
  token!: string;
  constructor(
    private router: Router, private cookieService: CookieService,
    @Inject(LOCAL_STORAGE) private storage: StorageService
  ) { }

  ngOnInit(): void {
    const token = this.cookieService.get(AppConfig.web.token);
    const profile: ProfileViewView = this.storage.get(AppConfig.web.store);
  }

  changeCollapsed(): void {
    this.collapsed = !this.collapsed;
    this.collapsedChange.emit(this.collapsed);
  }
  logout(): void {
    this.router.navigate(['/', 'Login']);
  }
}
